home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 301-325 / disk_319 / cnewssrc / cnews.orig.lzh / nntpdiffs / diff / newnews.c < prev    next >
Text File  |  1989-06-27  |  2KB  |  62 lines

  1. 258c258
  2. < seekuntil(fp, key, line, linesize)
  3. ---
  4. > seekuntil(fp, akey, line, linesize)
  5. 260c260
  6. <     char        *key;
  7. ---
  8. >     char        *akey;
  9. 266a267,268
  10. >     extern long dtol();
  11. >     char key[30];
  12. 267a270
  13. >     (void) sprintf(key, "%ld", dtol(akey));    /* akey -> time_t in ascii */
  14. 329a333,335
  15. > /*
  16. >  * C news version of getword.
  17. >  */
  18. 336a343
  19. >     extern char *index();
  20. 340,366c347,359
  21. <     if (cp = index(line, '\t')) {
  22. < /*
  23. <  * The following gross hack is present because the history file date
  24. <  * format is braindamaged.  They like "mm/dd/yy hh:mm", which is useless
  25. <  * for relative comparisons of dates using something like atoi() or
  26. <  * strcmp.  So, this changes their format into yymmddhhmm.  Sigh.
  27. <  *
  28. <  * 12345678901234    ("x" for cp[x])
  29. <  * mm/dd/yy hh:mm     (their lousy representation)
  30. <  * yymmddhhmm        (our good one)
  31. <  * 0123456789        ("x" for w[x])
  32. <  */
  33. <         *cp = '\0';
  34. <         (void) strncpy(w, cp+1, 15);
  35. <         w[0] = cp[7];        /* Years */
  36. <         w[1] = cp[8];
  37. <         w[2] = cp[1];        /* Months */
  38. <         w[3] = cp[2];
  39. <         w[4] = cp[4];        /* Days */
  40. <         w[5] = cp[5];
  41. <         w[6] = cp[10];        /* Hours */
  42. <         w[7] = cp[11];
  43. <         w[8] = cp[13];        /* Minutes */
  44. <         w[9] = cp[14];
  45. <         w[10] = '\0';
  46. <     } else
  47. <         w[0] = '\0';
  48. ---
  49. >     w[0] = '\0';                /* in case of bad format */
  50. >     if (cp = index(line, '\t')) {        /* find 2nd field */
  51. >         register char *endp;
  52. >         *cp++ = '\0';
  53. >         endp = index(cp, '~');        /* end of date-received */
  54. >         if (endp == NULL)
  55. >             endp = index(cp, '\t');    /* end of expiry */
  56. >         if (endp != NULL) {
  57. >             (void) strncpy(w, cp, endp - cp);
  58. >             w[endp - cp] = '\0';
  59. >         }
  60. >     }
  61.